<?php
namespace app\index\controller;
use app\index\model\Projectnotification_model;
use think\Controller;
use think\Session;
use think\Db;
use think\request;

//问题统计控制器
class Projectnotification extends Common
{

    //新建问题:选择项目
	public function configuration()
    {
        $Goods = new Projectnotification_model;
        $assignee = $Goods->assignee();
        $project_username = $Goods->project_username();
        $this->assign('assignee',$assignee);
        $this->assign('project_username',$project_username);
        return view('bu_configuration');
    }

    //添加新建问题
    public function configuration_add()
    {
        $params = input();
        $file = request()->file('problem_img');
        if (!$file) {
           echo "<script> alert('图片为空');location.href='configuration';</script>";die;
        }
        // $files = request()->file('problem_img');
        $model = new Projectnotification_model;
        $img = $model->uploadOne($file,$params);
        return $this->redirect('index/index');  
    }

    //发布通知
    public function notice()
    {
        return view('bu_notice');
    }
    public function notice_add()
    {
        $params = input();
        $model = new Projectnotification_model;
        $notice = $model->notice_add($params);
        return $this->redirect('index/index');  
    }


    //添加新建项目
    public function version()
    {
        return view('bu_version');
    }
    public function version_add()
    {
        $params = input();
        $model = new Projectnotification_model;
        $notice = $model->version_add($params);
        return $this->redirect('projectnotification/configuration');  
    }


    // 选择项目
    public function question()
    {
        $Goods = new Projectnotification_model;
        $question = $Goods->question();
        $this->assign('question',$question);
        return view('bu_question');
    }
}